<html>

<head>
    <script src="./libs/dat.gui.js"> </script>
    <script src="https://unpkg.com/vue"></script>

    <div id="app">
        <ol>
            <span>Message: {{ msg }}</span>
            <todo-item v-for="item in groceryList" v-bind:todo="item" v-bind:key="item.id"></todo-item>
            <span v-once>这个将不会改变: {{ msg }}</span>
        </ol>
    </div>
</head>

<body>
    <script>
        var gui = new dat.GUI();
        gui.open();

        Vue.component('todo-item', {
            props: ['todo'],
            template: '<li>{{ todo.text }} : {{ todo.price }} 元</li>'
        })

        var app = new Vue({
            el: '#app',
            data: {
                groceryList: [
                    { id: 0, text: '蔬菜', price: 10, },
                    { id: 1, text: '奶酪', price: 30, },
                    { id: 2, text: '随便其它什么人吃的东西', price: 0, }
                ],
                name: 'jiefu',
            },
            beforeCreate: function () {
                console.log('beforeCreate');
            },
            created: function () {
                console.log('created');
            },
            beforeMount: function () {

            },
            mount: function () {

            }
        });

        var folder = gui.addFolder('App');
        folder.open();
    </script>
</body>

</html>